package com.ruoyi.web.controller.system;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.SysTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: zhangzhe
 * @Date: 2023/10/11
 */
@Api(tags = "4公共接口")
@RestController
@RequestMapping("/system/resources")
public class SysResourcesController {

    @Autowired
    SysTaskService sysTaskService;

    @ApiOperation("4.1上传文件")
    @ApiOperationSupport(order = 1)
    @PostMapping("/uploadfile")
    public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @ApiParam("文件类型：1:图片,2:视频") @RequestParam("type") Integer type) {
        return sysTaskService.uploadFile(file, type);
    }

    @ApiOperation("4.2获取文件信息")
    @ApiOperationSupport(order = 2)
    @GetMapping("/getfileinfo")
    public AjaxResult getFile(@RequestParam("id") Long id) {
        return sysTaskService.getFile(id);
    }
}
